package com.example.userservice.client;

import com.example.learnflagservice.entity.chapter_completion;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = "learnFlag-service", url = "http://localhost:8185")
public interface LearnFlagClient {
    
    // 标记章节为已完成
    @PostMapping("/api/completion/complete")
    String completeChapter(@RequestBody Map<String, Object> requestBody);
    
    // 获取用户的章节完成情况
    @GetMapping("/api/completion/user/{userId}/course/{courseId}")
    List<chapter_completion> getUserChapterCompletions(@PathVariable int userId, @PathVariable int courseId);
    
    // 检查特定章节是否已完成
    @GetMapping("/api/completion/user/{userId}/chapter/{chapterId}")
    Map<String, Object> checkChapterCompletion(@PathVariable int userId, @PathVariable int chapterId);
    
    // 取消章节完成状态
    @DeleteMapping("/api/completion/user/{userId}/chapter/{chapterId}")
    String cancelChapterCompletion(@PathVariable int userId, @PathVariable int chapterId);
}
